import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import Layout from '@/Layout/index.vue'
const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/login',
        component: () => import('@/views/Login/index.vue')
    }
    /**,
    {
        path: '/:pathMatch(.*)*',
        component: () => import('@/views/404.vue')
    } */
]
//下面这些路由配置不是全量配置的
//而是要根据用户的权限进行过滤的，用户能访问此路由才能配置
export const dynamicRoutes: Array<RouteRecordRaw> = [
    {
        path: '/',
        component: Layout,
        children: [
            {
                path: 'home',
                component: () => import('@/views/Home/index.vue')
            },
            {
                path: 'system',
                children:[
                    {
                        path: 'menu',
                        component: () => import('@/views/Menu/index.vue')
                    },
                    {
                        path: 'role',
                        component: () => import('@/views/Role/index.vue')
                    },
                    {
                        path: 'user',
                        component: () => import('@/views/User/index.vue')
                    }
                ]
            }
        ]
    },
]
export default createRouter({
    history: createWebHistory(),//历史对象
    routes//路由配置
});